
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>qilucache · 启路框架-使用手册</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-insert-logo/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-toggle-chapters/toggle.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-lightbox/css/lightbox.min.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    


    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="qiluMybatis-readme.html" />
    
    
    <link rel="prev" href="qiluTask-readme.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    整体介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../ready/ready.html">
            
                <a href="../ready/ready.html">
            
                    
                    技术准备
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../ready/ide.html">
            
                <a href="../ready/ide.html">
            
                    
                    eclipse
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../ready/build.html">
            
                <a href="../ready/build.html">
            
                    
                    本地构建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../ready/nexus.html">
            
                <a href="../ready/nexus.html">
            
                    
                    私服构建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../ready/run.html">
            
                <a href="../ready/run.html">
            
                    
                    运行调试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../ready/specification.html">
            
                <a href="../ready/specification.html">
            
                    
                    结构和分包
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="baseReadme.html">
            
                <a href="baseReadme.html">
            
                    
                    基础包介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="qiluTask-readme.html">
            
                <a href="qiluTask-readme.html">
            
                    
                    qilu-task
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.2" data-path="cache-readme.html">
            
                <a href="cache-readme.html">
            
                    
                    qilucache
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="qiluMybatis-readme.html">
            
                <a href="qiluMybatis-readme.html">
            
                    
                    qilu-mybatis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="logTrace-readme.html">
            
                <a href="logTrace-readme.html">
            
                    
                    qilu-logTrace
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="qilu-export-readme.html">
            
                <a href="qilu-export-readme.html">
            
                    
                    qilu-export
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="httpService-readme.html">
            
                <a href="httpService-readme.html">
            
                    
                    qilu-http-service
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="validateReadme.html">
            
                <a href="validateReadme.html">
            
                    
                    qilu-validate
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../state/state-course.html">
            
                <a href="../state/state-course.html">
            
                    
                    交易一致的由来
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../state/state-settle.html">
            
                <a href="../state/state-settle.html">
            
                    
                    qilu-state使用说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../state/state-demo.html">
            
                <a href="../state/state-demo.html">
            
                    
                    购买订单的处理示例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../backSample/backSampleReadme.html">
            
                <a href="../backSample/backSampleReadme.html">
            
                    
                    后台代码模板
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../backSample/security.html">
            
                <a href="../backSample/security.html">
            
                    
                    安全介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../backSample/deploy.html">
            
                <a href="../backSample/deploy.html">
            
                    
                    部署集成
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../backSample/config.html">
            
                <a href="../backSample/config.html">
            
                    
                    spring配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../backSample/sso.html">
            
                <a href="../backSample/sso.html">
            
                    
                    SSO集成
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../backSample/example.html">
            
                <a href="../backSample/example.html">
            
                    
                    常见代码示例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../test/readme.html">
            
                <a href="../test/readme.html">
            
                    
                    关于测试
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../test/unitTest.html">
            
                <a href="../test/unitTest.html">
            
                    
                    单元测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../test/function.html">
            
                <a href="../test/function.html">
            
                    
                    功能测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../test/noFunction.html">
            
                <a href="../test/noFunction.html">
            
                    
                    非功能测试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../video/test.html">
            
                <a href="../video/test.html">
            
                    
                    视频
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../video/build.html">
            
                <a href="../video/build.html">
            
                    
                    项目构建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../video/state.html">
            
                <a href="../video/state.html">
            
                    
                    交易一致
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >qilucache</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="qilucache&#x4ECB;&#x7ECD;">qiluCache&#x4ECB;&#x7ECD;</h1>
<p>spring-cache&#x63D0;&#x4F9B;&#x4E86;&#x5F88;&#x597D;&#x7684;&#x8C03;&#x7528;&#x63A5;&#x53E3;,&#x5BF9;&#x4E8E;&#x5F00;&#x53D1;&#x4EBA;&#x5458;&#x5728;&#x4F7F;&#x7528;cache&#x7684;&#x65F6;&#x5019;,&#x53EF;&#x4EE5;&#x505A;&#x5230;&#x5F88;&#x7B80;&#x5355;.&#x4F46;&#x662F;spring-cache&#x6709;&#x4E0B;&#x9762;&#x51E0;&#x70B9;&#x505A;&#x7684;&#x5F88;&#x4E0D;&#x597D;,&#x800C;&#x4E14;&#x5728;&#x77ED;&#x65F6;&#x95F4;&#x5185;,&#x770B;&#x4E0D;&#x5230;spring&#x6709;&#x4F18;&#x5316;&#x7684;&#x53EF;&#x80FD;</p>
<ul>
<li>&#x6CA1;&#x6709;&#x63D0;&#x4F9B;&#x8FC7;&#x671F;&#x65F6;&#x95F4;&#x8BBE;&#x7F6E;,&#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x5F88;&#x4E25;&#x91CD;&#x7684;&#x95EE;&#x9898;</li>
<li>&#x6CA1;&#x6709;&#x9488;&#x5BF9;cache&#x7684;&#x9632;&#x7A7F;&#x900F;&#x5904;&#x7406;</li>
</ul>
<p>qilu-cache&#x4EFF;&#x7167;spring-cache&#x7684;api,&#x652F;&#x6301;&#x4E0A;&#x8FF0;2&#x79CD;&#x573A;&#x666F;,&#x7F13;&#x5B58;&#x6570;&#x636E;&#x5B58;&#x50A8;&#x4F7F;&#x7528;fastjson&#x505A;&#x6570;&#x636E;&#x5E8F;&#x5217;&#x5316;.&#x548C;&#x4E00;&#x822C;&#x7684;cache&#x5C01;&#x88C5;&#x4E0D;&#x592A;&#x4E00;&#x6837;,&#x9664;&#x4E86;&#x63D0;&#x4F9B;&#x539F;&#x59CB;&#x4ECB;&#x8D28;&#x7684;set,get&#x64CD;&#x4F5C;,&#x8FD8;&#x63D0;&#x4F9B;cacheService&#x7684;&#x9AD8;&#x7EA7;&#x5C01;&#x88C5;&#x64CD;&#x4F5C;,&#x53EF;&#x4EE5;&#x6709;&#x6548;&#x907F;&#x514D;&#x7F13;&#x5B58;&#x7A7F;&#x900F;.</p>
<h1 id="&#x4EE3;&#x7801;&#x96C6;&#x6210;">&#x4EE3;&#x7801;&#x96C6;&#x6210;</h1>
<h2 id="maven&#x5F15;&#x5165;">maven&#x5F15;&#x5165;</h2>
<pre class="language-"><code class="lang-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">&gt;</span></span>com.9istock.base<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">&gt;</span></span>qilu-cache-ehcache<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>version</span><span class="token punctuation">&gt;</span></span>1.0.0<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>version</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">&gt;</span></span>
</code></pre>
<h2 id="&#x4EE3;&#x7801;&#x8C03;&#x7528;">&#x4EE3;&#x7801;&#x8C03;&#x7528;</h2>
<h3 id="spring&#x914D;&#x7F6E;">spring&#x914D;&#x7F6E;</h3>
<pre class="language-"><code class="lang-xml"><span class="token comment">&lt;!-- &#x4F7F;&#x7528;baseCache&#x7684;api --&gt;</span>    
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>bean</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>baseCacheManager<span class="token punctuation">&quot;</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>com.istock.base.qiluCache.map.ConcurrentMapCacheManager<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>bean</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token namespace">cache:</span>baseCache</span> <span class="token attr-name">cacheManager</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>baseCacheManager<span class="token punctuation">&quot;</span></span><span class="token punctuation">/&gt;</span></span>
</code></pre>
<h3 id="java&#x8C03;&#x7528;">java&#x8C03;&#x7528;</h3>
<h4 id="&#x67E5;&#x8BE2;&#x4F7F;&#x7528;&#x7F13;&#x5B58;">&#x67E5;&#x8BE2;&#x4F7F;&#x7528;&#x7F13;&#x5B58;</h4>
<p>&#x7F13;&#x5B58;&#x7684;key&#x662F;spEL&#x8868;&#x8FBE;&#x5F0F;,&#x6240;&#x4EE5;&#x9700;&#x8981;&#x4F7F;&#x7528;<code>#</code>&#x5F00;&#x5934;,&#x652F;&#x6301;&#x4ECE;&#x63A5;&#x53E3;&#x53C2;&#x6570;&#x4E2D;&#x83B7;&#x53D6;
expireTime&#x662F;&#x8FC7;&#x671F;&#x65F6;&#x957F;,&#x5355;&#x4F4D;:&#x79D2;</p>
<pre class="language-"><code class="lang-java"><span class="token comment">//&#x5F53;&#x524D;&#x4EE3;&#x7801;&#x7684;&#x542B;&#x4E49;&#x662F;,&#x5728;&#x6267;&#x884C;queryById&#x7684;&#x65B9;&#x6CD5;&#x4E4B;&#x524D;,&#x9996;&#x5148;&#x628A;&#x4F20;&#x5165;&#x53C2;&#x6570;id&#x7684;&#x503C;&#x4F5C;&#x4E3A;cacke&#x7684;key,&#x53BB;cache&#x4E2D;&#x67E5;&#x8BE2;&#x662F;&#x5426;&#x5B58;&#x5728;&#x5BF9;&#x5E94;&#x7684;&#x6570;&#x636E;,&#x5982;&#x679C;&#x5B58;&#x5728;&#x5219;&#x4E0D;&#x518D;&#x6267;&#x884C;&#x5185;&#x90E8;&#x7684;&#x65B9;&#x6CD5;&#x903B;&#x8F91;&#x76F4;&#x63A5;&#x8FD4;&#x56DE;</span>
<span class="token comment">//&#x5982;&#x679C;cache&#x4E2D;&#x4E0D;&#x5B58;&#x5728;&#x5BF9;&#x5E94;id&#x7684;&#x503C;,&#x5219;&#x6267;&#x884C;&#x65B9;&#x6CD5;&#x4F53;,&#x5F53;&#x65B9;&#x6CD5;&#x6B63;&#x5E38;&#x8FD4;&#x56DE;&#x540E;,&#x5C06;&#x8FD4;&#x56DE;&#x503C;&#x8BBE;&#x7F6E;&#x5230;cache&#x91CC;,cache&#x7684;key&#x4F7F;&#x7528;&#x5165;&#x53C2;id&#x7684;&#x503C;</span>
<span class="token annotation punctuation">@UseCache</span><span class="token punctuation">(</span>key<span class="token operator">=</span><span class="token string">&quot;&apos;senvon1&apos;+#id&quot;</span><span class="token punctuation">,</span> expireTime <span class="token operator">=</span> <span class="token number">30</span><span class="token operator">*</span><span class="token number">60</span><span class="token punctuation">)</span>
<span class="token keyword">public</span> <span class="token class-name">TestObject</span> <span class="token function">queryById</span><span class="token punctuation">(</span><span class="token class-name">Long</span> id<span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token class-name">TestObject</span> result <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">TestObject</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    result<span class="token punctuation">.</span><span class="token function">setAge</span><span class="token punctuation">(</span><span class="token number">11</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    result<span class="token punctuation">.</span><span class="token function">setName</span><span class="token punctuation">(</span><span class="token string">&quot;senvon&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token class-name">TestObject</span> child <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">TestObject</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    child<span class="token punctuation">.</span><span class="token function">setAge</span><span class="token punctuation">(</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    child<span class="token punctuation">.</span><span class="token function">setName</span><span class="token punctuation">(</span><span class="token string">&quot;senvon child&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    result<span class="token punctuation">.</span><span class="token function">getChildren</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span>child<span class="token punctuation">)</span><span class="token punctuation">;</span>
    count<span class="token operator">++</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span> result<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<h4 id="&#x76F4;&#x63A5;&#x5220;&#x9664;&#x7F13;&#x5B58;">&#x76F4;&#x63A5;&#x5220;&#x9664;&#x7F13;&#x5B58;</h4>
<pre class="language-"><code class="lang-java"><span class="token comment">//&#x5728;&#x6267;&#x884C;&#x65B9;&#x6CD5;&#x524D;,&#x5220;&#x9664;cacheKey&#x4E3A;id&#x7684;&#x7F13;&#x5B58;</span>
<span class="token annotation punctuation">@DeleteCache</span><span class="token punctuation">(</span>key<span class="token operator">=</span><span class="token string">&quot;&apos;senvon1&apos;+#id&quot;</span><span class="token punctuation">)</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">deleteById</span><span class="token punctuation">(</span><span class="token class-name">Long</span> id<span class="token punctuation">)</span><span class="token punctuation">{</span>

<span class="token punctuation">}</span>
</code></pre>
<h4 id="&#x66F4;&#x65B0;&#x7F13;&#x5B58;">&#x66F4;&#x65B0;&#x7F13;&#x5B58;</h4>
<pre class="language-"><code class="lang-java"><span class="token comment">//&#x5148;&#x6267;&#x884C;&#x65B9;&#x6CD5;&#x4F53;</span>
<span class="token comment">//&#x5F53;&#x65B9;&#x6CD5;&#x6267;&#x884C;&#x8FD4;&#x56DE;&#x540E;,&#x66F4;&#x65B0;cachekey&#x4E3A;id&#x7684;&#x7F13;&#x5B58;,&#x66F4;&#x65B0;&#x5185;&#x5BB9;&#x5C31;&#x662F;&#x8FD4;&#x56DE;&#x7684;&#x5185;&#x5BB9;</span>
<span class="token annotation punctuation">@UpdateCache</span><span class="token punctuation">(</span>key<span class="token operator">=</span><span class="token string">&quot;&apos;senvon1&apos;+#id&quot;</span><span class="token punctuation">)</span>
<span class="token keyword">public</span> <span class="token class-name">TestObject</span> <span class="token function">updateById</span><span class="token punctuation">(</span><span class="token class-name">Long</span> id <span class="token punctuation">,</span> <span class="token class-name">TestObject</span> obj<span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token keyword">return</span> obj<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<h3 id="&#x624B;&#x52A8;&#x8C03;&#x7528;&#x7F13;&#x5B58;">&#x624B;&#x52A8;&#x8C03;&#x7528;&#x7F13;&#x5B58;</h3>
<p>&#x63D0;&#x4F9B;cacheService&#x7684;&#x9AD8;&#x7EA7;&#x7F13;&#x5B58;&#x64CD;&#x4F5C;&#x63A5;&#x53E3;,&#x5C06;get&#x548C;set&#x64CD;&#x4F5C;&#x8FDB;&#x884C;&#x6709;&#x6548;&#x7ED3;&#x5408;,&#x907F;&#x514D;&#x7F13;&#x5B58;&#x7A7F;&#x900F;.&#x5177;&#x4F53;&#x4F7F;&#x7528;&#x65B9;&#x5F0F;&#x5982;&#x4E0B;:</p>
<p>XML&#x914D;&#x7F6E;</p>
<pre class="language-"><code class="lang-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>bean</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>cacheService<span class="token punctuation">&quot;</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>com.istock.base.qiluCache.CacheService<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>property</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>cacheManager<span class="token punctuation">&quot;</span></span> <span class="token attr-name">ref</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>baseCacheManager<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>property</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>bean</span><span class="token punctuation">&gt;</span></span>
</code></pre>
<p>api&#x8C03;&#x7528;</p>
<pre class="language-"><code class="lang-java">cacheService<span class="token punctuation">.</span><span class="token function">findObject</span><span class="token punctuation">(</span><span class="token string">&quot;RECORD_USER_KEY&quot;</span><span class="token operator">+</span>ssoUser<span class="token punctuation">.</span><span class="token function">getUserId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token keyword">new</span> <span class="token class-name">TypeReference</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">Integer</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token number">10L</span><span class="token punctuation">,</span> <span class="token keyword">new</span> <span class="token class-name">CacheLoadCallback</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">Integer</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token annotation punctuation">@Override</span>
    <span class="token keyword">public</span> <span class="token class-name">Integer</span> <span class="token function">loadCache</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        aschTaskService<span class="token punctuation">.</span><span class="token function">userOnlineRecordUpdate</span><span class="token punctuation">(</span>ssoUser<span class="token punctuation">.</span><span class="token function">getToken</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> ssoUser<span class="token punctuation">.</span><span class="token function">getCurrentDept</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">!=</span> <span class="token keyword">null</span> <span class="token operator">?</span> ssoUser<span class="token punctuation">.</span><span class="token function">getCurrentDept</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">getDeptCode</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span><span class="token keyword">null</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span> <span class="token number">11</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>cacheService&#x4E0D;&#x4F46;&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x7F13;&#x5B58;&#x7684;&#x9632;&#x7A7F;&#x900F;&#x65B9;&#x6CD5;&#x4F7F;&#x7528;,&#x8FD8;&#x80FD;&#x4F5C;&#x4E3A;&#x4E00;&#x79CD;&#x7F13;&#x5B58;&#x9501;&#x673A;&#x5236;&#x800C;&#x4F7F;&#x7528;.</p>
<blockquote>
<p>[!WARNING]
&#x8BF7;&#x5404;&#x4F4D;&#x4ED4;&#x7EC6;&#x770B;&#x770B;&#x4E0A;&#x9762;&#x7684;&#x4EE3;&#x7801;,&#x8FD9;&#x5176;&#x5B9E;&#x662F;&#x4E00;&#x6BB5;<strong style="color:red">&#x7F13;&#x5B58;&#x9501;&#x64CD;&#x4F5C;</strong>,<strong style="color:red">return 11</strong>&#x8FD4;&#x56DE;&#x7684;&#x662F;&#x4E00;&#x4E2A;&#x56FA;&#x5B9A;&#x7684;&#x503C;,&#x8FD9;&#x6BB5;&#x8BDD;&#x7684;&#x610F;&#x601D;&#x662F;,&#x53BB;&#x7F13;&#x5B58;&#x4E2D;&#x53D6;&#x4E00;&#x4E2A;key&#x4E3A;RECORD_USERKKEY+userId&#x7684;&#x503C;,&#x5982;&#x679C;&#x4E0D;&#x5B58;&#x5728;,&#x5C31;&#x8C03;&#x7528;CacheLoadCallback&#x7684;loadCache&#x65B9;&#x6CD5;,&#x5982;&#x679C;&#x8FD9;&#x6BB5;&#x4EE3;&#x7801;&#x4E00;&#x76F4;&#x88AB;&#x8C03;&#x7528;,&#x4F1A;&#x6709;10&#x79D2;&#x7684;&#x65F6;&#x95F4;,&#x4E0D;&#x4F1A;&#x6267;&#x884C;loadCache&#x5185;&#x7684;&#x65B9;&#x6CD5;,&#x81F3;&#x4E8E;cache&#x7684;&#x5185;&#x5BB9;,&#x5E76;&#x4E0D;&#x662F;&#x5F88;&#x91CD;&#x8981;. </p>
</blockquote>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; senvon 2020 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">Bilibili,&#x5934;&#x6761;&#x53F7;,&#x5FAE;&#x4FE1;&#x53F7;&#xFF1A;&#x8BF7;&#x641C;&#x7D22;  &#x968F;senvon&#x98DE;
2021-09-01 14:35:15
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="qiluTask-readme.html" class="navigation navigation-prev " aria-label="Previous page: qilu-task">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="qiluMybatis-readme.html" class="navigation navigation-next " aria-label="Next page: qilu-mybatis">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"qilucache","level":"1.3.2","depth":2,"next":{"title":"qilu-mybatis","level":"1.3.3","depth":2,"path":"base/qiluMybatis-readme.md","ref":"base/qiluMybatis-readme.md","articles":[]},"previous":{"title":"qilu-task","level":"1.3.1","depth":2,"path":"base/qiluTask-readme.md","ref":"base/qiluTask-readme.md","articles":[]},"dir":"ltr"},"config":{"plugins":["search-plus","-lunr","-search","tbfed-pagefooter","simple-page-toc","insert-logo","back-to-top-button","toggle-chapters","code","lightbox","copy-code-button","search-pro","emphasize","splitter","mermaid-gb3","-sharing","sharing-plus","prism","-highlight","flexible-alerts","page-toc-button","baidu","pageview-count","bilibili","donate","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy senvon 2020","modify_label":"Bilibili,头条号,微信号：请搜索  随senvon飞"},"prism":{},"emphasize":{},"livereload":{},"simple-page-toc":{"maxDepth":5,"skipFirstH1":true},"splitter":{},"search-pro":{},"bilibili":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"code":{"copyButtons":true},"donate":{"alipay":"images/toutiao.jpg","alipayText":"头条号","button":"联系方式","title":"联系方式","wechat":"images/weixin.PNG","wechatText":"公众号"},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"lightbox":{"jquery":true,"sameUuid":false},"page-toc-button":{"maxTocDepth":5,"minTocSize":2},"back-to-top-button":{},"pageview-count":{},"flexible-alerts":{"danger":{"className":"danger","icon":"fa fa-ban","label":"Attention"},"note":{"className":"info","icon":"fa fa-info-circle","label":"Note"},"style":"flat","tip":{"className":"tip","icon":"fa fa-lightbulb-o","label":"Tip"},"warning":{"className":"warning","icon":"fa fa-exclamation-triangle","label":"Warning"}},"copy-code-button":{},"baidu":{"token":"51550945f89f43511a44753249ab6675"},"sharing":{"qq":true,"all":["douban","qq","qzone","weibo"],"douban":false,"facebook":false,"weibo":true,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":true,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"toggle-chapters":{},"insert-logo":{"style":"background: none; height: 170px; width: 200px","url":"images/logo3.jpg"},"search-plus":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"启路框架-使用手册","language":"zh-hans","backplugin":["lightbox"],"gitbook":"*","description":"启路框架-使用手册"},"file":{"path":"base/cache-readme.md","mtime":"2021-09-01T06:35:15.359Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-10-19T02:57:27.717Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-insert-logo/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lightbox/js/lightbox.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-baidu/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    <script src="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>

    </body>
</html>

